/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package modele;

/**
 *
 * @author sio
 */
public class Med implements Comparable <Med> { //implements pour la methode compareTo()

    //proprietes
    private String nom;
    private String prenom;
    private String adresse;
    private String tel;
    private String spe;
    private String id;

    //methodes
    public Med(String nom, String prenom, String adresse, String tel, String spe, String id) {
        this.nom = nom;
        this.prenom = prenom;
        this.adresse = adresse;
        this.tel = tel;
        this.spe = spe;
        this.id = id;
    }

    public String getAdresse() {
        return adresse;
    }

    public String getNom() {
        return nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public String getSpe() {
        return spe;
    }

    public String getTel() {
        return tel;
    }

    public int compareTo(Med m) {

        //comparaison du nom
        if (nom.compareTo(m.nom) == 0) {
            
            if (prenom.compareTo(m.prenom) == 0) {
                
                return id.compareTo(m.id);

            } 
            else {
                
                return prenom.compareTo(m.prenom);
            }
        } 
        else {
            
            return nom.compareTo(m.nom);
        }
    }

}
